package com.travelgroup.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "user", autoResultMap = true)
@Schema(description = "用户信息")
public class User {
    @TableId(type = IdType.AUTO)
    @Schema(description = "用户id")
    private Long id;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "邮箱地址")
    private String email;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "用户头像")
    private String avatar;

    @Schema(description = "用户偏好")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Double> preferences;

    @Schema(description = "最后登录时间")
    private LocalDate lastLoginTime;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    private Boolean deleted;
}
